//Zepto(endInit);
function endInit() {
  Zepto('#end-line').animateCss('fadeInDown', function() {
    Zepto('#end-line').css('opacity', 1);
  });
  Zepto('#end-avatar').animateCss('zoomIn', function() {
    Zepto('#end-avatar').css('opacity', 1);
    Zepto('#end-avatar-text').animateCss('fadeInDown', function() {
      Zepto('#end-avatar-text').css('opacity', 1);
      Zepto('#end-tip1').animateCss('fadeInDown', function() {
        Zepto('#end-tip1').css('opacity', 1);
        Zepto('#end-shape6').animateCss('rotateIn2');
        Zepto('#end-shape5').animateCss('rotateIn', function() {
          Zepto('#end-shape6, #end-shape5').css('opacity', 1);
          Zepto('#end-light0').animateCss('fadeIn', function() {
            Zepto('#end-light0').css('opacity', 1);
          });
          setTimeout(function() {
            Zepto('#end-light1').animateCss('fadeIn', function() {
              Zepto('#end-light1').css('opacity', 1);
            });
          }, 200);
          setTimeout(function() {
            Zepto('#end-light2').animateCss('fadeIn', function() {
              Zepto('#end-light2').css('opacity', 1);
            });
          }, 400);
          Zepto('#end-result').animateCss('zoomIn', function() {
            Zepto('#end-result').css('opacity', 1);
          });
          Zepto('#end-result-left').animateCss('fadeInLeft', function() {
            Zepto('#end-result-left').css('opacity', 1);
          });
          Zepto('#end-result-right').animateCss('fadeInRight', function() {
            Zepto('#end-result-right').css('opacity', 1);
          });
          Zepto('#end-result-bottom').animateCss('fadeInUp', function() {
            Zepto('#end-result-bottom').css('opacity', 1);
            showLoopText();
          });
        });
      });
    });
  });
}

function showLoopText() {
  var $item = Zepto('.end-fade-down');
  var index = 0;
  var loop = function() {
    if(index === $item.length) {
    clearTimeout(time);
    setTimeout(animEnd, 1000);
      return;
    }
    const now = index;
    Zepto($item.get(index)).animateCss('fadeIn', function() {
      Zepto($item.get(now)).css('opacity', 1);
    });
    index++;

    var time = setTimeout(loop, 300);
  };

  setTimeout(loop, 200);
}
// 动画结束
function animEnd() {
  location.href = "./img.html";
    // location.href = "/html/img.html?source=" + getQueryStringByName('source') + '&src=' + encodeURIComponent($('#end-result-img').attr('src'))+'&v='+Math.random();
}
//Zepto(goImgPate);

 document.addEventListener('touchmove', function (e) { e.preventDefault(); }, isPassive() ? {
 	capture: false,
 	passive: false
 } : false);
